package com.project.service.impl;

import com.project.bean.ClassBean;
import com.project.mapper.IClassMapper;
import com.project.service.IClassService;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class ClassService extends BaseService implements IClassService {
    @Override
    public List<ClassBean> findAllClass() {
        SqlSession session=this.getSession();
        IClassMapper mapper=session.getMapper(IClassMapper.class);
        List<ClassBean>list=mapper.findAllClass();
        session.close();
        return list;
    }

    @Override
    public void addClass(ClassBean classBean) {
        SqlSession session=this.getSession();
        IClassMapper mapper=session.getMapper(IClassMapper.class);
        mapper.addClass(classBean);
        session.commit();
        session.close();

    }

    @Override
    public boolean deleteClass(int classId) {
        SqlSession session=this.getSession();
        IClassMapper mapper=session.getMapper(IClassMapper.class);
        mapper.deleteClass(classId);
        session.commit();
        session.close();

        return false;
    }
}
